package com.cg.client;

import com.cg.dto.*;
import com.cg.vo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(name = "user-provider")
public interface UserClient {

    //登录
    @PostMapping("/user/login")
    public Dto<Object[]> login(@RequestBody LoginDto loginDto);

    //根据Token获取用户信息
    @PostMapping("/user/loadCurrentUserByToken")
    public Dto findUserByToken(@RequestParam("token") String token);


    //刷新Token
    @PostMapping("/user/replaceToken")
    public Dto<TokenVO> replaceToken(@RequestParam("token") String token);


    //获取注册验证码接口
    @PostMapping("/user/code")
    public Dto sendSms(@RequestBody UserRegDto userRegDto);

    @PostMapping("/user/checkEmail")
    public Dto checkEmail(@RequestBody UserRegDto userRegDto);

    //新用户注册
    @PostMapping("/user/register")
    public Dto register(@RequestBody RegDto regDto);


    //个人信息获取
    //根据token获取个人信息
    @PostMapping("/user/queryUserInfoByToken")
    public Dto<LoginUserVo> queryUserInfoByToken(@RequestParam("token") String token);


    //用户信息修改---无头像修改
    @PostMapping("/user/modifyUserInfo")
    public Dto updateUser(@RequestBody UpdateUserVo updateUserVo);


    //根据订单状态、订单创建时间、关键词(商品名称，订单号，商品编号模糊)
    @PostMapping("/order/queryOrderList")
    public Dto<List<OrderManagerVo>> queryOrderList(@RequestBody OrderManagerDto orderManagerDto);


    //根据订单号查询订单
    @PostMapping("/order/queryOrderByOrderNo")
    public Dto<QueryOrderVo> queryOrderByOrderNo(@RequestParam("orderNo") String orderNo);


    //订单支付
    @GetMapping("/order/toPay")
    public String toPay(@RequestParam("orderNo") String orderNo) throws Exception;


    //同步通知
    @PostMapping("/order/returnUrl")
    public String returnUrl(@RequestBody Map<String,String[]> map);


    //异步通知
    @PostMapping("/order/aliNotify")
    public String notifyUrl(@RequestBody Map<String,String[]> map);
}
